#=======================================================================
# UCB CS250 Makefile fragment for benchmarks
#-----------------------------------------------------------------------
#
# Each benchmark directory should have its own fragment which
# essentially lists what the source files are and how to link them
# into an riscv and/or host executable. All variables should include
# the benchmark name as a prefix so that they are unique.
#

richards_cxx_src = richards.cpp new_op.cpp
richards_c_src = syscalls.c
richards_riscv_src = crt.S

richards_cxx_objs     = $(patsubst %.cpp, %.o, $(richards_cxx_src))
richards_c_objs     = $(patsubst %.c, %.o, $(richards_c_src))
richards_riscv_objs = $(patsubst %.S, %.o, $(richards_riscv_src))

richards_host_bin = richards.host
$(richards_host_bin): $(richards_cxx_src)
	g++ $^ -o $(richards_host_bin) $(cxxincs) -fno-exceptions -fno-rtti

richards_riscv_bin = richards.riscv
$(richards_riscv_bin): $(richards_cxx_objs) $(richards_c_objs) $(richards_riscv_objs)
	$(RISCV_LINK) $(richards_cxx_objs) $(richards_c_objs) $(richards_riscv_objs) \
    -o $(richards_riscv_bin) $(RISCV_LINK_OPTS)

junk += $(richards_cxx_objs) $(richards_c_objs) $(richards_riscv_objs) \
        $(richards_host_bin) $(richards_riscv_bin)
